import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn } from 'typeorm';
import { IsNotEmpty } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
@Entity()
export class User {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ comment: '用户名' })
  @ApiProperty({ description: '用户名', example: 'admin' })
  @IsNotEmpty({ message: '用户名不能为空' })
  name: string;

  @Column({ comment: '密码' })
  @ApiProperty({ description: '密码', example: '123456' })
  @IsNotEmpty({ message: '密码不能为空' })
  password: string;

  @Column({ comment: '是否激活', default: true })
  is_active: boolean;

  @Column({ comment: '方向', default: 1 })
  @ApiProperty({ description: '方向', example: 1 })
  direction: number;

  @Column('double', { comment: '账户余额(USDT)', default: 0 })
  @ApiProperty({ description: '账户余额(USDT)', example: 1 })
  balance: number;

  @Column({ comment: '关联芝麻', default: '-' })
  @ApiProperty({ description: '关联芝麻', example: '1' })
  zhiMaId: string;

  @Column({ comment: '芝麻静资产', default: '0' })
  @ApiProperty({ description: '芝麻静资产', example: '1' })
  ziChan: string;

  @Column({ comment: '芝麻静资产更新时间', default: '0' })
  @ApiProperty({ description: '芝麻静资产更新时间', example: '1' })
  ziChanTime: string;

  @Column({ comment: '用户总资产', default: '0' })
  @ApiProperty({ description: '用户总资产', example: '1' })
  allMoney: string;

  @Column({ comment: '芝麻盈亏', default: '0' })
  @ApiProperty({ description: '芝麻历史仓位总盈亏', example: '1' })
  yingKui: string;

  @Column({ comment: '同步时间', default: '0' })
  @ApiProperty({ description: '同步芝麻历史仓位时间', example: '1' })
  tongBuTime: string;

  @CreateDateColumn({
    type: 'timestamp',
    nullable: false,
    name: 'create_time',
    comment: '创建时间',
  })
  create_time: Date;

  @UpdateDateColumn({
    type: 'timestamp',
    nullable: false,
    name: 'update_time',
    comment: '更新时间',
  })
  update_time: string;
}
